﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace FreeboxHDVideoPlayer
{
    public class VideoLocalCache
    {
        private const string localCachePath = @"d:\freeboxhd";

        public static void Init()
        {
            if (!Directory.Exists(localCachePath))
            {
                Directory.CreateDirectory(localCachePath);
            }
        }

        public static string Drive
        {
            get
            {
                return Path.GetPathRoot(localCachePath).Replace("\\", "");
            }
        }

        public static bool Exists(string fileName)
        {
            return File.Exists(GetLocalPath(fileName));
        }

        public static long Size(string fileName)
        {
            return new FileInfo(GetLocalPath(fileName)).Length;
        }

        public static void Delete(string fileName)
        {
            File.Delete(GetLocalPath(fileName));
        }

        public static string GetLocalPath(string fileName)
        {
            return Path.Combine(localCachePath, fileName);
        }
    }
}
